https://www.everything-birthday.com/name/f/Betty says the following.
"Betty is predominantly a girls name, with 99.64% of Bettys being girls, and 0.36% being boys.
In the United States there have been a total of 3619 males named Betty, and 999979 females given the name".
I wonder if most of the males named Betty were intersexual (hermaphrodites) and thus if their sex (male or female) was ambiguous when born (especially if they were born before genetic tests were available). Another possibility that maybe they looked more like girls when they were born, thus causing the doctor and the parents to think the newborn baby was a girl. For example, maybe their testes had not yet descended. See https://www.childrenshospital.org/conditions/undescended-testes-cryptorchidism which says the following.
"Undescended testicles, also known as cryptorchidism, is a fairly common and normally painless congenital condition in which one or both of a baby's testicles (testes) have not moved into the proper position. One to 2 percent of male infants are affected. ...
Premature babies are affected by undescended testicles at a higher rate. The more premature your baby is, the higher the chance of having an undescended testicle."
Another possibility is that maybe in many cases the parents really wanted a girl to be born instead of a boy, and/or maybe they were expecting a girl to be born, and thus gave the baby a girl's name. Another possibility is that the parents of the child didn't know the name is overwhelmingly a girl's name. https://babynames.com/name/betty says the following.
"The name Betty is primarily a female name of English origin that means God Is My Oath.
diminutive form of Elizabeth"